# -*- coding: utf-8 -*-

from PyQt5.QtWidgets import *
import sys


class Message(QWidget):
    def __init__(self):
        super(Message, self).__init__()
        self.setWindowTitle("对话框 例子")
        self.resize(200, 200)
        self.Mybtn = QPushButton("点击弹出", self)
        self.Mybtn.clicked.connect(self.btn_)

    def btn_(self):
        # 父窗口，对话标题框，文本内容，按钮|默认为OK，默认选中
        res = QMessageBox.information(self, "QA", "ERROR", QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
        # 如果两个ID先等，执行
        if res == QMessageBox.No:
            sys.exit(app.exec_())


if __name__ == '__main__':
    app = QApplication(sys.argv)
    mess = Message()
    mess.show()
    sys.exit(app.exec_())
